﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Moqikaka.DAL
{
    using Moqikaka.Model;
    using MySql.Data.MySqlClient;
    using System.Data;

    /// <summary>
    /// 登录信息数据
    /// </summary>
    public class LoginLogDAL : GameBaseDAL
    {

        #region  属性

        static string _GetLastLoginTime = @"SELECT  userid,PartnerId,playerid,LoginTime FROM loginlog 
WHERE userid=@UserId AND PartnerId=@PartnerId 
ORDER BY LoginTime DESC LIMIT 1,1"; 

        #endregion

        #region 函数

        /// <summary>
        /// 获取某个玩家的上次登录时间 此次不算
        /// </summary>
        /// <param name="playerId">玩家id</param>
        /// <returns>登录对象</returns>
        public static DataTable GetPlayerLastLoginTime(string userId,Int32 partnerId)
        {

            MySqlParameter[] paramList = new MySqlParameter[]
			{
				new MySqlParameter("@UserId", userId),
				new MySqlParameter("@PlayerId", partnerId)
			};

            return ExecuteDataTable(GameBaseDAL.DBConnectionString, _GetLastLoginTime, paramList);
        } 
        #endregion
    }
}
